import 'package:json_annotation/json_annotation.dart';
import 'package:lovify/models/enums/message_status.dart';
import 'package:lovify/models/enums/message_type.dart';
import 'package:lovify/models/schedule.dart';
import 'package:lovify/models/user.dart';
import 'base_entity.dart';

part 'message.g.dart';

@JsonSerializable(explicitToJson: true)
class Message extends BaseEntity {
  final User? from;
  final User? to;
  final String? content;
  final MessageType? msgType;
  final MessageStatus? msgStatus;
  final DateTime? sentAt;
  final String? fileName;
  final Schedule? schedule;

  Message({
    super.id,
    super.created,
    super.updated,
    super.deleted,
    this.from,
    this.to,
    this.content,
    this.msgType,
    this.msgStatus,
    this.sentAt,
    this.fileName,
    this.schedule,
  });

  factory Message.fromJson(Map<String, dynamic> json) =>
      _$MessageFromJson(json);

  @override
  Map<String, dynamic> toJson() => _$MessageToJson(this);
}
